package com.yycx.module.bus.provider.handler.haiying.tasktodo.backorder;

import com.yycx.common.constants.CommonConstants;
import com.yycx.module.bus.client.entity.hy.BusPaymentOrder;
import com.yycx.module.bus.client.entity.hy.HyOrder;
import com.yycx.module.bus.provider.service.hy.HyOrderService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 退货通知审批结束监听器
 *
 * @author zyf
 */
@Component
public class HyBackOrderProcessEndListener implements ExecutionListener {



    @Resource
    private HyOrderService orderService;

    @Override
    public void notify(DelegateExecution delegateExecution) {
        String businessKey = delegateExecution.getVariable("businessKey", String.class);
        HyOrder busOrder = orderService.getById(businessKey);
        String orderId = busOrder.getOrderId();
        orderService.updateOrderState(orderId, CommonConstants.INT_2);
    }

}
